﻿using System;
using System.Collections.Generic;
using System.Text;

namespace PropertyCreator
{
    class DbTypes
    {
        public const int SqlServer2005 = 1;
        public const int SqlServer2008 = 2;

        private static IList<DbItem> listDb;

        static DbTypes()
        {
            if (null == listDb)
            {
                listDb = new List<DbItem>();
                listDb.Add(new DbItem(SqlServer2005, "SqlServer2005"));
                listDb.Add(new DbItem(SqlServer2008, "SqlServer2008"));
            }
        }

        public static IList<DbItem> GetList()
        {
            return listDb;
        }

        public static DbItem Get(int id)
        {
            foreach (DbItem item in listDb)
            {
                if (id == item.Id)
                    return item;
            }
            return null;
        }
    }

    class DbItem
    {
        public DbItem() { }

        public DbItem(int Id, string Name)
        {
            this.Id = Id;
            this.Name = Name;
        }

        public int Id { set; get; }
        public string Name { set; get; }
    }
}
